Recognizing prime and composite numbers